<style>
    #login-button{
        background: #286090!important;
        color: white!important;
        border: 1px solid #286090!important;
        border-radius: 3px;
    }
</style>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>

<div class="span10">
    <div style="margin-bottom: 20px;">
        <a href="/index/index">首页</a><span >&gt;</span><span>弹窗管理</span><span >&gt;</span><span>添加/修改</span>
    </div>

    <form name="form" method="post" action="<?php echo baseUrl."/content/popup/add"?>" enctype="multipart/form-data">
        <table>
            <tr>
                <td>所属端*:</td>
                <td>
                    <select name="port">
                        <option value ="">请选择所属端</option>
                        <?php foreach ($port as $k=>$v):?>
                        <option value ="<?php echo $k?>" <?php echo $data['port']==$k ?  'selected':''?>><?php echo $v?></option>
                        <?php endforeach;?>
                    </select>
                </td>
            </tr>
            <tr>
                <td width="80px">位置 *:</td>
                <td>
                    <select name="belong">
                        <option value ="">请选择</option>
                        <?php foreach ($belong as $k=>$v):?>
                            <option value ="<?php echo $k?>" <?php echo $data['belong']==$k ?  'selected':''?>><?php echo $v?></option>
                        <?php endforeach;?>
                    </select>
                </td>
            </tr>
            <?php if(isset($data)) {
                $str = '<tr>';
                $str .= '<td>原图片:</td>';
                $str .= '<td>';
                $pic = $data['pic'];
                $str .= "<input name='pic' type='text' value='" . $pic . "'></td></tr>";
                echo $str;
            } ?>

            <tr>
                <td width="120px">上传、修改图片*:</td>
                <td>
                    <input id="file" type="file" name="pic" >
                </td>
            </tr>

            <tr>
                <td>跳转类型*:</td>
                <td>
                    <select name="type">
                        <option value ="">请选择</option>
                        <?php foreach ($type as $k=>$v):?>
                            <option value ="<?php echo $k?>" <?php echo $data['type']==$k ?  'selected':''?>><?php echo $v?></option>
                        <?php endforeach;?>
                    </select>
                </td>
            </tr>

            <tr>
                <td>外链地址:</td>
                <td>
                    <input  type="text" name="url" value="<?php echo isset($data)? $data['url']:''?>" />
                </td>
            </tr>
            <tr>
                <td>内容ID:</td>
                <td>
                    <input  type="text" name="contentId" value="<?php echo isset($data)? $data['contentId']:''?>" />
                </td>
            </tr>
            <tr>
                <td>有效期*:</td>
                <td>
                    <input class="input-small Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" type="text" style="width: 150px;" name="startTime" value="<?php echo isset($data['startTime']) ? date('Y-m-d', $data['startTime']) : '' ?>"/>
                    <input class="input-small Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" type="text" style="width: 150px;" name="endTime" value="<?php echo isset($data['endTime']) ? date('Y-m-d', $data['endTime']) : '' ?>"/>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                    <input type="hidden" name='id' value="<?php echo isset($data)? $data['id']:''?>"/>
                    <button type="submit" id="login-button">添加/修改</button></td>
            </tr>
            <input type="hidden" name="_csrf" value="<?=Yii::$app->request->getCsrfToken()?>" />
        </table>
    </form>

</div>